//
//  YBUserModel.swift
//  Moonlight
//
//  Created by Penlon Kim on 2024/1/1.
//  Copyright © 2024 Moonlight Game Streaming Project. All rights reserved.
//

import UIKit

// MARK: - 用户登录model
class YBUserModel: BaseModel, Codable {
    enum Gender: Int {
        case man = 1
        case female
        case unknow
    }
    
    enum UserType: Int {
        case client = 0
        case designCloud = 3
        case association = 4
        case build = 5
        case gameCloud = 6
    }
    
    class OrderInfoVos: BaseModel, Codable {
        enum OrderType: Int {
            case recharge = 0
            case silverBean
            case combo
            case bgConfig
        }
        
        enum VmType: Int {
            case exclusive = 1
            case share
        }
        
        enum VmStatus: Int {
            case close = 0
            case open
        }
        
        var comboName: String = ""
        var compare: String = ""
        var cpu: String = ""
        var dailyTime: Int = 0
        var endTime: String = ""
        var goodsId: String = ""
        var gpuName: String = ""
        var gpuType: String = ""
        var hardPan: String = ""
        var id: String = ""
        var link: String = ""
        var memory: String = ""
        var orderSn: String = ""
        var orderType: Int = 0
        var payAmount: String = ""
        var productName: String = ""
        var purchase: Bool = true
        var remark: String = ""
        var startTime: String = ""
        var surplusDaily: String = ""
        var surplusTotal: String = ""
        var totalTime: Int = 0
        var type: Int = 0
        var userId: String = ""
        var vmStatus: Int = 0
        var check: String = ""
        
        var _isSunshine: Bool {
            return check.contains("sunshine")
        }
        
        var _orderType: OrderType {
            return OrderType(rawValue: orderType) ?? .recharge
        }
        
        var _type: VmType {
            return VmType(rawValue: type) ?? .exclusive
        }
        
        var _vmStatus: VmStatus {
            return VmStatus(rawValue: vmStatus) ?? .close
        }
    }
    
    var age: Int = 0
    var avatar: String = ""
    var company: String = ""
    var dept: String = ""
    var deviceId: String = ""
    var devicessType: String = ""
    var email: String = ""
    var expireTime: String = ""
    var gender: Int = 0
    var id: String = ""
    var machineType: Int = 0
    var mdev: String = ""
    var mobile: String = ""
    var nickName: String = ""
    var openid: String = ""
    var position: String = ""
    var promoCode: String = ""
    var realName: String = ""
    var remark: String = ""
    var source: String = ""
    var spreadUid: String = ""
    var state: Int = 0
    var userName: String = ""
    var userType: Int = 0
    var orderInfoVos: [OrderInfoVos] = []
    
    var _gender: Gender {
        return Gender(rawValue: gender) ?? .unknow
    }
    
    var _userType: UserType {
        return UserType(rawValue: userType) ?? .client
    }
    
}
